<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #top{
            position: relative;
            display: inline-block;
        }
        #btn{
            position: absolute;
            top: 5px;
            right: 5px;
        }
    </style>
</head>
<body>
    <div id="top">
        <img src="/study-js//课堂练习/webAPI/第二单元/02.jpg" alt="">
        <button id="btn">x</button>
    </div>
    <script>
        const closebtn = document.getElementById('btn')
        const closetop = document.getElementById('top')
        closebtn.addEventListener('click',function(){
        closetop.style.display = 'none'
        })
    </script>
</body>
</html>